package com.tpp.base.elastic;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
 * 索引文档元数据
 */
@Data
@Document(indexName = "item-index")
public class ItemSource {

    @Field(type = FieldType.Integer)
    private Integer itemTypeId1;

    @Field(type = FieldType.Integer)
    private Integer itemTypeId2;

    @Field(type = FieldType.Integer)
    private Integer areaId;//查 cinema表

    @Id
    @Field(type = FieldType.Integer)
    private Integer id;

    @Field(type = FieldType.Keyword)
    private String imgUrl;//远程调用

    @Field(type = FieldType.Keyword)
    private String areaName;//查cinema表

    @Field(type = FieldType.Text,analyzer="ik_max_word")
    private String itemName;

    @Field(type = FieldType.Text,analyzer="ik_max_word")
    private String abstractMessage;

    @Field(type = FieldType.Date_Nanos,format = {DateFormat.date_hour_minute_second_fraction,DateFormat.date_hour_minute_second,DateFormat.date_hour_minute,DateFormat.date})
    private LocalDateTime startTime;

    @Field(type = FieldType.Date_Nanos,format = {DateFormat.date_hour_minute_second_fraction,DateFormat.date_hour_minute,DateFormat.date_hour_minute,DateFormat.date})
    private LocalDateTime endTime;

    @Field(type = FieldType.Double)
    private Double minPrice;

    @Field(type = FieldType.Double)
    private Double maxPrice;

    @Field(type = FieldType.Text,analyzer="ik_max_word")
    private String address;

    @Field(type = FieldType.Integer)
    private String latitude;

    @Field(type = FieldType.Integer)
    private String longitude;

    //推荐 0不推荐 1推荐
    @Field(type = FieldType.Integer)
    private Integer isRecommend;

    //推荐 0默认 1热推
    @Field(type = FieldType.Integer)
    private Integer isBanner;

    //平均分
    @Field(type = FieldType.Double)
    private Double avgScore;

    //评论数
    @Field(type = FieldType.Integer)
    private Integer commentCount;


}
